bitkeeper revision 1.1108.33.41 (410f5cae_2UrWZA0rcb91kIdTgrTFg)
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Tue, 3 Aug 2004 09:36:46 +0000 (09:36 +0000)
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Tue, 3 Aug 2004 09:36:46 +0000 (09:36 +0000)
Debug builds of Xen now reverse DOM0's address space, to trigger
those hard-to-find bugs.

xen/arch/x86/domain.c

index 6f6b7b620f9a7f639badadbd926ac0911f466899..768d25c49ce797aec6a4a72736dc24fb115c2f26 100644 (file)
@@ -772,11 +772,14 @@ int construct_dom0(struct domain *p,
     si->mfn_list     = vphysmap_start;
 
     /* Write the phys->machine and machine->phys table entries. */
-    for ( mfn = (alloc_start>>PAGE_SHIFT); 
-          mfn < (alloc_end>>PAGE_SHIFT); 
-          mfn++ )
+    for ( pfn = 0; pfn < p->tot_pages; pfn++ )
     {
-        pfn = mfn - (alloc_start>>PAGE_SHIFT);
+        mfn = pfn + (alloc_start>>PAGE_SHIFT);
+#ifndef NDEBUG
+#define REVERSE_START ((v_end - v_start) >> PAGE_SHIFT)
+        if ( pfn > REVERSE_START )
+            mfn = (alloc_end>>PAGE_SHIFT) - (pfn - REVERSE_START);
+#endif
         ((unsigned long *)vphysmap_start)[pfn] = mfn;
         machine_to_phys_mapping[mfn] = pfn;
     }